<?php
/**
 * 字段有:
 * 	id
 * 	
 */
//对{percust } ... {/percust }的解析
function smarty_block_percust (&$params, $content, &$smarty, &$repeat){
   return $smarty->callblockfunc($params,$content,$smarty,$repeat, getpercust);
}

/**
 * 参数：
 * 	
 * @param unknown_type $params
 */
function getpercust(&$params) {
	$table = "t_percust";
	$tprefix = "$table.c_";
	
	//#region 构建sql条件语句
	$sqlwhere = "1=1 ";
	
	if(!isempty($params["mobile"])){
		$sqlwhere .= " and {$tprefix}mobile='$params[mobile]' ";
	}
	
	if(!isempty($params["name"])){
		$sqlwhere .= " and {$tprefix}name='$params[name]' ";
	}
	
	if(!isempty($params["city"])){
		$sqlwhere .= " and {$tprefix}city='$params[city]' ";
	}
	//#endreg 构建sql条件语句
	
	return getcommbc("percust", $params, null, null, $sqlwhere);
}

function addpercust($params){
	global $_db;
	return $_db->insert("percust", array("name"=>@$params['name'],"gender"=>@$params['gender'],"mobile"=>@$params['mobile'],"othercontact"=>@$params['othercontact'],"city"=>@$params['city'],"address"=>@$params['address'],"age"=>@$params['age'],"workstatus"=>@$params['workstatus'],"orgtype"=>@$params['orgtype'],"workremark"=>@$params['workremark'],"married"=>@$params['married'],"cplworkstatus"=>@$params['cplworkstatus'],"cplorgtype"=>@$params['cplorgtype'],"cplworkremark"=>@$params['cplworkremark'],"incomelvl"=>@$params['incomelvl'],"incometype"=>@$params['incometype'],"incomeremark"=>@$params['incomeremark'],"curworktime"=>@$params['curworktime'],"curworkremark"=>@$params['curworkremark'],"hashouse"=>@$params['hashouse'],"houseremark"=>@$params['houseremark'],"hascar"=>@$params['hascar'],"carremark"=>@$params['carremark'],"credit"=>@$params['credit'],"creditremark"=>@$params['creditremark'],"debt"=>@$params['debt'],"debtremark"=>@$params['debtremark'],"remark"=>@$params['remark']));
}
?>